<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAdminTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //创建数据表
        Schema::create('admin',function (Blueprint $table) {
            $table->increments('id');//自增主键
            $table->string('username',20)->notNull();//用户名
            $table->string('password')->notNull();//密码字段
            $table->enum('gender',['1','2','3'])->default('1');//性别字段
            $table->string('mobile',11);//手机号
            $table->string('email',50);//邮箱
            $table->tinyInteger('role_id');//角色id
            $table->timestamps();//添加created_at字段 和 updated_at字段 [datetime]类型
            $table->rememberToken();//记住登录功能需要的字段
            $table->enum('status',['1','2'])->default('2');//帐号状态 默认启用
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //删除数据表
        Schema::dropIfExists('admin');
    }
}
